Skip to content

Conversation

@filipecabaco
Copy link
Member

What kind of change does this PR introduce?

Limits broadcasting messages with payloads bigger than what the tenant as set as the limit

@coveralls
Copy link

coveralls commented Oct 22, 2025

Coverage Status

coverage: 86.745% (+0.4%) from 86.31%
when pulling 8f4c4c7 on feat/broadcast-payload-size
into 7f28e0f on main.

@filipecabaco filipecabaco force-pushed the feat/broadcast-payload-size branch from d7faa75 to 219e6cc Compare October 24, 2025 14:02
Comment on lines 387 to 389
Process.sleep(120)

refute_received {:socket_push, :text, _}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Process.sleep(120)
refute_received {:socket_push, :text, _}
refute_receive {:socket_push, :text, _}, 120

Comment on lines 368 to 370
Process.sleep(120)

refute_received {:socket_push, :text, _}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Process.sleep(120)
refute_received {:socket_push, :text, _}
refute_receive {:socket_push, :text, _}, 120

Comment on lines 345 to 347
Process.sleep(120)

refute_received {:socket_push, :text, _}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Process.sleep(120)
refute_received {:socket_push, :text, _}
refute_receive {:socket_push, :text, _}, 120

Comment on lines 330 to 332
Process.sleep(120)

refute_received {:socket_push, :text, _}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Process.sleep(120)
refute_received {:socket_push, :text, _}
refute_receive {:socket_push, :text, _}, 120

messages: list(%{id: String.t(), topic: String.t(), payload: map(), event: String.t(), private: boolean()})
},
super_user :: boolean()
) :: :ok | {:error, atom()}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So does it return :ok | {:error, atom() | changeset ? Should it be {:error, changeset} to be consistent?


@doc """
"""
@spec validate_payload_size(Tenant.t() | binary(), map()) :: :ok | {:error, :payload_size_exceeded}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we update PresenceHandler to also use this function?

Copy link
Member

@edgurgel edgurgel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a few comments but other than those LGTM

Limits broadcasting messages with payloads bigger than what the tenant as set as the limit
@filipecabaco filipecabaco force-pushed the feat/broadcast-payload-size branch 2 times, most recently from ffe3480 to aec1438 Compare October 27, 2025 13:25
@filipecabaco filipecabaco force-pushed the feat/broadcast-payload-size branch from aec1438 to 8f4c4c7 Compare October 27, 2025 17:11
@filipecabaco filipecabaco merged commit 469f56d into main Oct 27, 2025
6 checks passed
@filipecabaco filipecabaco deleted the feat/broadcast-payload-size branch October 27, 2025 18:03
@kiwicopple
Copy link
Member

🎉 This PR is included in version 2.57.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

{:noreply, state}
else
{:error, %Ecto.Changeset{valid?: false} = changeset} ->
error = Ecto.Changeset.traverse_errors(changeset, &elem(&1, 0))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice

end

def call(conn, %Ecto.Changeset{valid?: true} = changeset) do
def call(conn, {:error, %Ecto.Changeset{valid?: false} = changeset}) do
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compiling 10 files (.ex)
    warning: this clause cannot match because a previous clause at line 32 always matches
    │
 48 │   def call(conn, {:error, %Ecto.Changeset{valid?: false} = changeset}) do
    │       ~
    │
    └─ lib/realtime_web/controllers/fallback_controller.ex:48:7

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants